package com.blacktea.behavioralpatterns.chainofresponsibilitypattern.controller;

import com.blacktea.behavioralpatterns.chainofresponsibilitypattern.handler.RequestLogger;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @description: 测试请求日志责任链接口
 * @author: black tea
 * @date: 2023/3/24 16:41
 */
@RequestMapping("/request/test")
@RestController
@RequiredArgsConstructor
public class RequestLoggerTestController {

    private final RequestLogger requestLogger;

    @RequestMapping("{name}")
    public String handlerRequest(@PathVariable String name, HttpServletRequest request){
        requestLogger.handler(request);
        return "请求处理成功";
    }

}
